package com.glsc.ngateway.common.base.domain.mysql.opmanagemain.outsys;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.DateSerializer;
import com.glsc.ngateway.common.api.common.enums.DictConstant;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.Where;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @author liwei
 * 外部系统名称信息表
 */
@Data
@Entity
@Table(name = "t_out_system_info")
@org.hibernate.annotations.Table(appliesTo = "t_out_system_info", comment = "外部系统名称信息表")
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Where(clause = "enable_flag = 'Y'")
public class OutSystemInfo implements Serializable {

    private static final long serialVersionUID = -9166019246262366062L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Integer id;

    @Column(name = "sys_name", columnDefinition = "varchar(100) COMMENT '系统名称'")
    @ApiModelProperty(value = "系统名称")
    private String sysName;

    @ApiModelProperty(value = "是否启用，字典 YesNo:（N=禁用 Y=启用)")
    @Column(name = "enable_flag", columnDefinition = "varchar(20) default 'N' COMMENT '是否启用，字典 YesNo:（N=禁用 Y=启用)'")
    private String enableFlag = DictConstant.YES;

    //创建时间
    @Column(name = "create_time", updatable = false)
    @org.hibernate.annotations.CreationTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = DateSerializer.class)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间")
    private Date createTime;


}
